package com.stars.services.impl.pshow;

import com.github.pagehelper.PageInfo;
import com.stars.entity.dto.pshow.PShowOrdersInfoDTO;
import com.stars.dao.mapper.pshow.PShowOrdersInfoMapper;
import com.stars.entity.pshow.PShowOrdersInfoEntity;
import com.stars.services.pshow.PShowOrdersInfoAccessServices;
import com.stars.dao.mapper.pshow.PShowOrdersInfoMapper;

import java.util.List;
import com.stars.entity.ListPage;
import com.github.pagehelper.PageHelper;
import com.stars.services.impl.BaseAccessServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Title: 订单明细表 业务逻辑
 * @author 肖伟
 * @date 2020-01-04
 * @version V1.0
 *
 */
@Service
public class PShowOrdersInfoAccessServicesImpl  extends BaseAccessServiceImpl<PShowOrdersInfoMapper , PShowOrdersInfoEntity> implements  PShowOrdersInfoAccessServices {
    @Autowired
    private PShowOrdersInfoMapper  pShowOrdersInfoMapper;


    /**
     * 分页查询
     * @param pageNum 查询参数 起始页，大小。
     * @return
     */
    @Override
    public PageInfo<PShowOrdersInfoDTO> pageList(Integer pageNum, Integer pageSize, PShowOrdersInfoDTO dto) throws Exception{
        ListPage<PShowOrdersInfoDTO> listPage = new ListPage<>(pageNum, pageSize, dto);
        PageHelper.startPage(pageNum, pageSize);
        List<PShowOrdersInfoDTO> list = pShowOrdersInfoMapper.pageQueryPShowOrdersInfo(listPage);
        PageInfo<PShowOrdersInfoDTO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public PShowOrdersInfoDTO findDtoById(String id) {
        if (StringUtils.isBlank(id)) {
            return null;
        }
        return pShowOrdersInfoMapper.selectDtoById(id);
    }

}
